# coding=utf-8
class Reverse:
    """Iterator for looping over a sequence backwards."""
    def __init__(self, data):
        self.data = data
        self.index = len(data)
        print self.data
    def __iter__(self):
        return self
    def next(self):
        if self.index == 0:
            raise StopIteration
        self.index = self.index - 2
        return self.data[self.index]

if __name__ == '__main__':
    rev = Reverse('abcde')
    for i in rev:
        print i
